There is a project that needs to generate Word files, format
Have seen Phpword and phpdocx, found that it is difficult to dynamically generate in the format,
If it's HTML, it's simple typography, so you're going to generate HTML, and then turn the HTML into Word,
But looking for a long time, as if only phpdocx of the pay version can be perfect to the HTML layout format into WordThe free version is not able
found 31excel5.xls. n ");}$ Reader = PHPExcel_IOFactory: createReader ('excel5'); // set to Excel5 format (Excel97-2003 workbook)$ PHPExcel = $ reader-> load ("31excel5.xls"); // load an excel file$ Sheet = $ PHPExcel-> getSheet (0); // read first ?? Worksheet$ HighestRow = $ sheet-> getHighestRow (); // gets the total number of rows.$ HighestColumm = $ sheet-> getHighestColumn (); // gets the total number of Columns/** Read the data of each cell cyclically */For ($ row = 1; $ row For ($ column
. $row)->getvalue (). "
";
}
}
?>
2,phpdocx PHP classes that manipulate word
Phpdocx is a PHP class library for generating fully dynamic, fully compatible Word documents.
You may need to generate reports directly from any data collection or tabular file. These reports may include icons, pictures, tables, start, end, and so on.
); Read first?? Work table$highestRow = $sheet->gethighestrow (); Get total number of rows$highestColumm = $sheet->gethighestcolumn (); Total number of columns obtained/** cycle reads data for each cell.for ($row = 1; $row for ($column = ' a '; $column $dataset [] = $sheet->getcell ($column. $row)->getvalue ();Echo $column. $row. ":" $sheet->getcell ($column. $row)->getvalue (). }}?>
2,phpdocx to manipulate Word's PHP class
document.xml in the word directory
The contents of the Docx file are in the document.xml, so we can read the file.
/*** Read Docx File** @param string $file filepath* @return String file content*/function Parseword ($file) {$content = "";$zip = new Ziparchive ();if ($zip->open ($file) = = TR) {for ($i = 0; $i $entry = $zip->getnameindex ($i);if (PathInfo ($entry, pathinfo_basename) = = "Document.xml") {$zip->extractto (PathInfo ($file, Pathinfo_dirname). "/" . PathInfo ($file, Pathinfo_filena
Contact Us
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.